fix more tests
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 15 May 2016 21:48:11 +0000 (00:48 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 18 May 2016 22:42:29 +0000 (01:42 +0300)
tests/test_cargo_bench.rs
tests/test_cargo_compile_path_deps.rs
tests/test_cargo_run.rs
tests/test_cargo_search.rs

index 51d02f7079d3f24efd82b75e8c016d24d00c89bf..967368be8862b74c7c4a66a1c2b3ad2e63d82a85 100644 (file)
@@ -96,17 +96,17 @@ test!(cargo_bench_verbose {
         "#);
 
     assert_that(p.cargo_process("bench").arg("-v").arg("hello"),
-        execs().with_stdout(&format!("\
+                execs().with_stderr(&format!("\
 [COMPILING] foo v0.5.0 ({url})
 [RUNNING] `rustc src[..]foo.rs [..]`
-[RUNNING] `[..]target[..]release[..]foo-[..] hello --bench`
-
+[RUNNING] `[..]target[..]release[..]foo-[..] hello --bench`", url = p.url()))
+                       .with_stdout("
 running 1 test
 test bench_hello ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-", url = p.url())));
+"));
 });
 
 test!(many_similar_names {
@@ -230,24 +230,23 @@ test!(bench_with_lib_dep {
         ");
 
     assert_that(p.cargo_process("bench"),
-        execs().with_stdout(&format!("\
+                execs().with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({})
 [RUNNING] target[..]release[..]baz-[..]
-
+[RUNNING] target[..]release[..]foo-[..]", p.url()))
+                       .with_stdout("
 running 1 test
 test bin_bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-[RUNNING] target[..]release[..]foo-[..]
 
 running 1 test
 test lib_bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-        p.url())))
+"))
 });
 
 test!(bench_with_deep_lib_dep {
@@ -292,18 +291,17 @@ test!(bench_with_deep_lib_dep {
     p2.build();
     assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
-                       .with_stdout(&format!("\
+                       .with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ([..])
 [COMPILING] bar v0.0.1 ({dir})
-[RUNNING] target[..]
-
+[RUNNING] target[..]", dir = p.url()))
+                       .with_stdout("
 running 1 test
 test bar_bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-                       dir = p.url())));
+"));
 });
 
 test!(external_bench_explicit {
@@ -338,24 +336,23 @@ test!(external_bench_explicit {
         "#);
 
     assert_that(p.cargo_process("bench"),
-        execs().with_stdout(&format!("\
+                execs().with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({})
 [RUNNING] target[..]release[..]bench-[..]
-
+[RUNNING] target[..]release[..]foo-[..]", p.url()))
+                       .with_stdout("
 running 1 test
 test external_bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-[RUNNING] target[..]release[..]foo-[..]
 
 running 1 test
 test internal_bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-        p.url())))
+"))
 });
 
 test!(external_bench_implicit {
@@ -387,24 +384,23 @@ test!(external_bench_implicit {
         "#);
 
     assert_that(p.cargo_process("bench"),
-        execs().with_stdout(&format!("\
+                execs().with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({})
 [RUNNING] target[..]release[..]external-[..]
-
+[RUNNING] target[..]release[..]foo-[..]", p.url()))
+                       .with_stdout("
 running 1 test
 test external_bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-[RUNNING] target[..]release[..]foo-[..]
 
 running 1 test
 test internal_bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-        p.url())))
+"))
 });
 
 test!(dont_run_examples {
@@ -446,23 +442,22 @@ test!(pass_through_command_line {
 
     assert_that(p.cargo_process("bench").arg("bar"),
                 execs().with_status(0)
-                       .with_stdout(&format!("\
+                .with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({dir})
-[RUNNING] target[..]release[..]foo-[..]
-
+[RUNNING] target[..]release[..]foo-[..]", dir = p.url()))
+                .with_stdout("
 running 1 test
 test bar ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-                       dir = p.url())));
+"));
 
     assert_that(p.cargo("bench").arg("foo"),
                 execs().with_status(0)
-                       .with_stdout("\
-[RUNNING] target[..]release[..]foo-[..]
-
+                       .with_stderr("\
+[RUNNING] target[..]release[..]foo-[..]")
+                       .with_stdout("
 running 1 test
 test foo ... bench: [..] 0 ns/iter (+/- 0)
 
@@ -526,24 +521,23 @@ test!(lib_bin_same_name {
         ");
 
     assert_that(p.cargo_process("bench"),
-        execs().with_stdout(&format!("\
+                execs().with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({})
 [RUNNING] target[..]release[..]foo-[..]
-
+[RUNNING] target[..]release[..]foo-[..]", p.url()))
+                       .with_stdout("
 running 1 test
 test [..] ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-[RUNNING] target[..]release[..]foo-[..]
 
 running 1 test
 test [..] ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-        p.url())))
+"))
 });
 
 test!(lib_with_standard_name {
@@ -579,24 +573,23 @@ test!(lib_with_standard_name {
 
     assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
-                       .with_stdout(&format!("\
+                       .with_stderr(&format!("\
 [COMPILING] syntax v0.0.1 ({dir})
 [RUNNING] target[..]release[..]bench-[..]
-
+[RUNNING] target[..]release[..]syntax-[..]", dir = p.url()))
+                       .with_stdout("
 running 1 test
 test bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-[RUNNING] target[..]release[..]syntax-[..]
 
 running 1 test
 test foo_bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-                       dir = p.url())));
+"));
 });
 
 test!(lib_with_standard_name2 {
@@ -630,17 +623,16 @@ test!(lib_with_standard_name2 {
 
     assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
-                       .with_stdout(&format!("\
+                       .with_stderr(&format!("\
 [COMPILING] syntax v0.0.1 ({dir})
-[RUNNING] target[..]release[..]syntax-[..]
-
+[RUNNING] target[..]release[..]syntax-[..]", dir = p.url()))
+                       .with_stdout("
 running 1 test
 test bench ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-                       dir = p.url())));
+"));
 });
 
 test!(bench_dylib {
@@ -694,7 +686,7 @@ test!(bench_dylib {
 
     assert_that(p.cargo_process("bench").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(&format!("\
+                       .with_stderr(&format!("\
 [COMPILING] bar v0.0.1 ({dir}/bar)
 [RUNNING] [..] -C opt-level=3 [..]
 [COMPILING] foo v0.0.1 ({dir})
@@ -702,43 +694,41 @@ test!(bench_dylib {
 [RUNNING] [..] -C opt-level=3 [..]
 [RUNNING] [..] -C opt-level=3 [..]
 [RUNNING] [..]target[..]release[..]bench-[..]
-
+[RUNNING] [..]target[..]release[..]foo-[..]", dir = p.url()))
+                       .with_stdout("
 running 1 test
 test foo ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-[RUNNING] [..]target[..]release[..]foo-[..]
 
 running 1 test
 test foo ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-                       dir = p.url())));
+"));
     p.root().move_into_the_past().unwrap();
     assert_that(p.cargo("bench").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(&format!("\
+                       .with_stderr(&format!("\
 [FRESH] bar v0.0.1 ({dir}/bar)
 [FRESH] foo v0.0.1 ({dir})
 [RUNNING] [..]target[..]release[..]bench-[..]
-
+[RUNNING] [..]target[..]release[..]foo-[..]", dir = p.url()))
+                       .with_stdout("
 running 1 test
 test foo ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-[RUNNING] [..]target[..]release[..]foo-[..]
 
 running 1 test
 test foo ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-                       dir = p.url())));
+"));
 });
 
 test!(bench_twice_with_build_cmd {
@@ -762,23 +752,22 @@ test!(bench_twice_with_build_cmd {
 
     assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
-                       .with_stdout(&format!("\
+                       .with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({dir})
-[RUNNING] target[..]release[..]foo-[..]
-
+[RUNNING] target[..]release[..]foo-[..]", dir = p.url()))
+                       .with_stdout("
 running 1 test
 test foo ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-                       dir = p.url())));
+"));
 
     assert_that(p.cargo("bench"),
                 execs().with_status(0)
-                       .with_stdout("\
-[RUNNING] target[..]release[..]foo-[..]
-
+                       .with_stderr("\
+[RUNNING] target[..]release[..]foo-[..]")
+                       .with_stdout("
 running 1 test
 test foo ... bench: [..] 0 ns/iter (+/- 0)
 
@@ -842,28 +831,27 @@ test!(bench_with_examples {
 
     assert_that(p.cargo_process("bench").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(&format!("\
+                       .with_stderr(&format!("\
 [COMPILING] testbench v6.6.6 ({url})
 [RUNNING] `rustc [..]`
 [RUNNING] `rustc [..]`
 [RUNNING] `rustc [..]`
 [RUNNING] `{dir}[..]target[..]release[..]testb1-[..] --bench`
-
+[RUNNING] `{dir}[..]target[..]release[..]testbench-[..] --bench`",
+                dir = p.root().display(), url = p.url()))
+                       .with_stdout("
 running 1 test
 test bench_bench2 ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-[RUNNING] `{dir}[..]target[..]release[..]testbench-[..] --bench`
 
 running 1 test
 test bench_bench1 ... bench: [..] 0 ns/iter (+/- 0)
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
-",
-                       dir = p.root().display(),
-                       url = p.url())));
+"));
 });
 
 test!(test_a_bench {
@@ -893,10 +881,10 @@ test!(test_a_bench {
 
     assert_that(p.cargo_process("test"),
                 execs().with_status(0)
-                       .with_stdout("\
+                       .with_stderr("\
 [COMPILING] foo v0.1.0 ([..])
-[RUNNING] target[..]debug[..]b-[..]
-
+[RUNNING] target[..]debug[..]b-[..]")
+                       .with_stdout("
 running 1 test
 test foo ... ok
 
index 5589f0ef75e0b42e38e10847c709bf2b93345578..535823874a1063b458174e7a9bf46ccc201af7af 100644 (file)
@@ -174,11 +174,11 @@ test!(cargo_compile_with_root_dev_deps_with_testing {
 
     p2.build();
     assert_that(p.cargo_process("test"),
-        execs().with_stdout("\
+                execs().with_stderr("\
 [COMPILING] [..] v0.5.0 ([..])
 [COMPILING] [..] v0.5.0 ([..])
-[RUNNING] target[..]foo-[..]
-
+[RUNNING] target[..]foo-[..]")
+                       .with_stdout("
 running 0 tests
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
index 8e77964037d99249dde3d6abb97e536294c0250a..39352b695f9c2a3b79f5b0b90ca7a39c00db1c72 100644 (file)
@@ -197,24 +197,25 @@ test!(specify_name {
         "#);
 
     assert_that(p.cargo_process("run").arg("--bin").arg("a").arg("-v"),
-                execs().with_status(0).with_stdout(&format!("\
+                execs().with_status(0)
+                       .with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({dir})
 [RUNNING] `rustc src[..]lib.rs [..]`
 [RUNNING] `rustc src[..]a.rs [..]`
-[RUNNING] `target{sep}debug{sep}a[..]`
+[RUNNING] `target{sep}debug{sep}a[..]`", dir = path2url(p.root()), sep = SEP))
+                       .with_stdout("\
 hello a.rs
-",
-        dir = path2url(p.root()),
-        sep = SEP)));
+"));
 
     assert_that(p.cargo("run").arg("--bin").arg("b").arg("-v"),
-                execs().with_status(0).with_stdout(&format!("\
+                execs().with_status(0)
+                       .with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ([..])
 [RUNNING] `rustc src[..]b.rs [..]`
-[RUNNING] `target{sep}debug{sep}b[..]`
+[RUNNING] `target{sep}debug{sep}b[..]`", sep = SEP))
+                       .with_stdout("\
 hello b.rs
-",
-        sep = SEP)));
+"));
 });
 
 test!(run_example {
@@ -234,13 +235,13 @@ test!(run_example {
         "#);
 
     assert_that(p.cargo_process("run").arg("--example").arg("a"),
-                execs().with_status(0).with_stdout(&format!("\
+                execs().with_status(0)
+                       .with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({dir})
-[RUNNING] `target{sep}debug{sep}examples{sep}a[..]`
+[RUNNING] `target{sep}debug{sep}examples{sep}a[..]`", dir = path2url(p.root()), sep = SEP))
+                       .with_stdout("\
 example
-",
-        dir = path2url(p.root()),
-        sep = SEP)));
+"));
 });
 
 test!(run_with_filename {
@@ -323,13 +324,13 @@ test!(one_bin_multiple_examples {
         "#);
 
     assert_that(p.cargo_process("run"),
-                execs().with_status(0).with_stdout(&format!("\
+                execs().with_status(0)
+                       .with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({dir})
-[RUNNING] `target{sep}debug{sep}main[..]`
+[RUNNING] `target{sep}debug{sep}main[..]`", dir = path2url(p.root()), sep = SEP))
+                       .with_stdout("\
 hello main.rs
-",
-        dir = path2url(p.root()),
-        sep = SEP)));
+"));
 });
 
 test!(example_with_release_flag {
@@ -376,7 +377,8 @@ test!(example_with_release_flag {
         "#);
 
     assert_that(p.cargo_process("run").arg("-v").arg("--release").arg("--example").arg("a"),
-                execs().with_status(0).with_stdout(&format!("\
+                execs().with_status(0)
+                       .with_stderr(&format!("\
 [COMPILING] bar v0.0.1 ({url}/bar)
 [RUNNING] `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \
         -C opt-level=3 \
@@ -395,15 +397,17 @@ test!(example_with_release_flag {
         -L dependency={dir}{sep}target{sep}release{sep}deps \
          --extern bar={dir}{sep}target{sep}release{sep}deps{sep}libbar-[..].rlib`
 [RUNNING] `target{sep}release{sep}examples{sep}a[..]`
-fast1
-fast2
 ",
         dir = p.root().display(),
         url = path2url(p.root()),
-        sep = SEP)));
+        sep = SEP))
+                       .with_stdout("\
+fast1
+fast2"));
 
     assert_that(p.cargo("run").arg("-v").arg("--example").arg("a"),
-                execs().with_status(0).with_stdout(&format!("\
+                execs().with_status(0)
+                       .with_stderr(&format!("\
 [COMPILING] bar v0.0.1 ({url}/bar)
 [RUNNING] `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \
         -g \
@@ -422,12 +426,13 @@ fast2
         -L dependency={dir}{sep}target{sep}debug{sep}deps \
          --extern bar={dir}{sep}target{sep}debug{sep}deps{sep}libbar-[..].rlib`
 [RUNNING] `target{sep}debug{sep}examples{sep}a[..]`
-slow1
-slow2
 ",
         dir = p.root().display(),
         url = path2url(p.root()),
-        sep = SEP)));
+        sep = SEP))
+                       .with_stdout("\
+slow1
+slow2"));
 });
 
 test!(run_dylib_dep {
@@ -541,10 +546,10 @@ test!(run_from_executable_folder {
     p.cargo_process("build").exec_with_output().unwrap();
 
     assert_that(p.cargo("run").cwd(cwd),
-                execs().with_status(0).with_stdout(&format!("\
-[RUNNING] `.{sep}foo[..]`
+                execs().with_status(0)
+                       .with_stderr(&format!("\
+[RUNNING] `.{sep}foo[..]`", sep = SEP))
+                       .with_stdout("\
 hello
-",
-        sep = SEP
-        )));
+"));
 });
index d557e28285abf15b2e7dbff40a6fd6dd9eed6f6a..a58bfa1b29eb6c27585e4b1eb7cc8ea3e844c9af 100644 (file)
@@ -80,8 +80,10 @@ test!(simple {
     }
 
     assert_that(cargo_process("search").arg("postgres"),
-                execs().with_status(0).with_stdout("\
-[UPDATING] registry `[..]`
+                execs().with_status(0)
+                       .with_stderr("\
+[UPDATING] registry `[..]`")
+                       .with_stdout("\
 hoare (0.1.1)    Design by contract style assertions for Rust"));
 });
 
@@ -126,8 +128,10 @@ test!(multiple_query_params {
     }
 
     assert_that(cargo_process("search").arg("postgres").arg("sql"),
-                execs().with_status(0).with_stdout("\
-[UPDATING] registry `[..]`
+                execs().with_status(0)
+                       .with_stderr("\
+[UPDATING] registry `[..]`")
+                       .with_stdout("\
 hoare (0.1.1)    Design by contract style assertions for Rust"));
 });